/*结构类型后台*/
'use strict';
const structureAddAction = require('../actions/structure/structureAddAction');
const structureDelAction = require('../actions/structure/structureDelAction');
const structureUpdateAction = require('../actions/structure/structureUpdateAction');
const structureQueryAction = require('../actions/structure/structureQueryAction');

module.exports = async function (ctx) {
    let param = ctx.method === 'GET' ? ctx.query : ctx.request.fields;
    let action_type = param.action_type;
    try {
        switch (action_type) {
            case 'structureAdd': //结构类型添加
                ctx.body = await structureAddAction(param);
                break;
            case 'structureDel': //结构类型删除
                ctx.body = await structureDelAction(param);
                break;
            case 'structureUpdate': //结构类型修改
                ctx.body = await structureUpdateAction(param);
                break;
            case 'structureQuery': //结构类型查询
                ctx.body = await structureQueryAction(param);
                break;

        }
    } catch (e) {
        ctx.body = {success: false, message: e.message};
    }

};